{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**This notebook visualizes the values of the LM damping factors learned by PixLoc (Figure 8).**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "import torch\n",
    "import numpy as np\n",
    "import matplotlib as mpl\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from pixloc.pixlib.utils.experiments import load_experiment\n",
    "from pixloc import run_CMU, run_Aachen"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Read the damping values from the checkpoints"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "experiments = {\n",
    "    'CMU': run_CMU.experiment,\n",
    "    'MD': run_Aachen.experiment,\n",
    "}\n",
    "dampings = {}\n",
    "for k, exper in experiments.items():\n",
    "    print('Exeperiment', exper)\n",
    "    optimizer = load_experiment(exper).eval().optimizer\n",
    "    dampings[k] = []\n",
    "    for i in range(3):\n",
    "        with torch.no_grad():\n",
    "            damp = optimizer[i].dampingnet().cpu().numpy()\n",
    "        print(damp)\n",
    "        dampings[k].append(damp)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Plot the values at the coarse level"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbYAAADxCAYAAACnI5IQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAtM0lEQVR4nO3deZgU5dX38e8ZZsBhRgQBR0BxFGRHQBC3qCQIuLyERE2ICopr0McVnxg1bvBoInHXaBQNEtSocYtIQA1RNC4RFEERlEUBZV9UtmEZ5rx/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KCg22GHHdb2rbfeqh8/zZ/+9KfGzZs375yfn9/txz/+cetly5ZVeoQ/d+7cun369GlVUFDQraCgoFvfvn1bzZ8/Py82ftiwYc0PPvjgjqNGjWq0//77dyooKOh2/PHHt1q6dGmFZc+fPz/vd7/7XcvBgweveOGFFxb0799/Xdu2bbf07dt3w+OPP77ogQce+Dp++oEDB64eO3bs918gmzdvtueff77xwIEDV1cWv+yc9t/o+2/MwIEDV0+YMKHRd9999/337ujRo5uUt18mU7977rmncbNmzTrn5+d3+8lPftL6tttuaxp/qjWZdQ+Qn59f1rJly9JWrVptPe644zbeeeedS5944on5//73vxs+8MADjZON6b777mtcv379bn/729/2Ki4u7lSvXr1DDz/88DazZs2qGxt/9913N5s3b94esX3nvvvu2678E0888aD8/Pxu++23X+cHH3xw78rWaUWU2HaxUaNGfdW1a9cNsV9JCxcunNGqVavvjyRuuOGGFsOHD188Y8aMmccdd9yGtWvX5vTr12/thAkT5kydOnVW//79vznrrLNaffTRR3tUspyiTp06bfzvf/8767LLLlt2yy237Ddp0qQCgLKyMvr27dt66dKlec8///zc999/f9ZRRx217qSTTmq7cOHCPIDXX3+94LLLLisePHjwyvfff3/WSSed9O3IkSNb7GyZ27Zt46c//WnrVatW5U2cOPHziRMnfr58+fK8AQMGtC4r++EH+eLFi+s+++yzez/33HPzX3rppTmzZs2qf9VVV1VY9hNPPNFo69atdvPNNy8rb3yTJk22xX8+99xzV3/yyScFn376aT2AZ555Zq/69etv+8lPfrJuZ/FL5bT/Rt9/Y7p06VJy0EEHbRo9evTeYTm5b7311l5Dhw5dFT9dMvWbNGlSwbBhw4rPPffcle+///6sk08++duRI0c2jy+nquse4NRTT1178MEHl/zjH/9olGxMAFu2bLHf//73zUeNGvXl66+/Pnvbtm12yimntC4rK+Pcc89dc8EFFywvLi7eFNt3zj333DWxeW+//fbm/fv3/3bq1KmzBgwYsObyyy8vnjt3bt3KYi1Pdl5jq8EaN268LS8vz2O/khLHX3fddUtOOeWUtbHPzZs3Lz3yyCNLYp9Hjhy57JVXXmn41FNPNerWrdvSipZzzDHHfHfdddetBOjUqdOKUaNG7fPaa681OP744zeMHz9+z9mzZ9dfsWLF9MLCQge49957l7z66qsNH3nkkb1vueWW5Xffffc+RxxxxNqRI0cuAzjkkEM2f/DBBwV///vfm1S0zHHjxjWYM2dO/qxZsz5p27btFoCnnnrqi06dOnUeN27cnj/72c/WAWzbts2efvrpBY0bN94GMHjw4JVPPfVUheXOnTt3j8LCwm3FxcVbK16zP2jatOm23r17f/vQQw81uf/++xc/9thjTU4//fTVZkmdGZOd0P4bff+NN3jw4FWPP/54kyuvvHLVww8/3Lh79+7rY8uKSaZ+99577z5HH3302ltvvXW7+j399NPfx3HkkUeWVGXdx7Rp02bT7Nmz85ONKbZu7rrrrkV9+/bdAPC3v/3ty/bt23+//goLC8tyc3Mpb9857bTTVl988cVrAO65557Fo0eP3udf//pX4cEHH7wmcdrK6IithjnqqKM2xn9eu3ZtztChQ/dr1apVxwYNGnStX79+t08//bTgq6++2ukvmU6dOpXEf95nn322rlixIhdg6tSp9Tdt2pSzzz77dK1fv3632GvevHn5X3zxxR4A8+bNy+/Zs+eG+DKOOOKI7T4n+vTTT/do2rTp1vh/1A4dOmxp2rTp1pkzZ+bHhjVr1mxL7EsBoHnz5lvXrFmTl1heTFW6fTvvvPNWPfvss43nzZuX98477zT49a9/varyuSRV2n937vzzz18ze/bs/BkzZtR78sknm5x99tk77JfJ1q979+7b1SexvlVd9zHuTuzHYDIxAeTk5HDcccd9vw+0adNmh/VXkUMOOeT7bZ6Xl0ejRo1KV6xYkdR6TaQjthomviUfwEUXXbTf5MmT97r11lu/at++/eaCgoKywYMHH7hly5adHn7k5eVtlw3MjLKyMoOgv7XGjRtvfeONNz5PnK9Ro0bbEoelQ/zRUgWxVThvmzZtNq1fv77OggUL8pI9ahswYMDaSy65xM8888wDjzjiiHWtWrXaOnv27O1OwTRs2HAbwJo1a+oktopcu3Ztnb322qta1kU20/67c40bN97Wt2/fby+88MIDVq1alTd48OAdWkGmq35VXfcxc+fO3aNly5abo8ZU1U4zElvGRlmviXTElgF5eXll27Ylt39OnTq18Je//OXqIUOGfHv44YeXHHTQQVsWLVpUL5Xl9+jRY+Pq1avzcnJyvFOnTpvjXy1atCgFaN26dcnUqVML4ud7//33C8ovMdCxY8dNK1euzPv888+//0U4a9asuitXrsxL/AUexZlnnvlNXl6e33zzzeV2obNq1ao6icPq1KnDwIEDV0+ZMmXPc845p9yjtY4dO27Kycnhvffe2+6i/KxZs+quX7++TocOHdRdWzm0/6bm/PPPXzVlypQ9BwwYsKZ+/fo7JIFk6zdt2rTt6pNY31TW/fPPP99g7ty5+T//+c+/STYmCK7FTZ48+fs45s6dW3flypV5HTt23ARQt27dpPedVCixZUDLli23TJ8+veDzzz+vu3Tp0tydbegDDzxw8z//+c+Gb7/9dv0pU6bkn3LKKUn/4qrIgAED1nbr1m39z372s9Z///vfG3z22Wd1J02aVHDllVc2f+WVVwoBrrjiihXvvfdeg2uvvXbfTz75pN6dd97Z5NVXX21YWblt2rQpOf300w9666236r/11lv1zzjjjIM6dOiwsX///lVuuNG6deutI0aM+Grs2LH7nHLKKcXjx4/fc86cOXUnTZpUcPbZZ+9/ySWX7FfefLfddtvSJUuWzDjrrLPKvTeoUaNGZQMHDlx144037vfEE080/Oyzz+pOnDix8IwzzjioS5cuG/r167e+vPl2d9p/U9O/f/91S5YsmfHwww9/VdX6XX755SveeeedBjfccEPRJ598Uu/uu+9u8sorr2xXv2TXfUlJSc6iRYty58+fn/fmm2/Wv+qqq5oNGjSoVe/evb+96KKLVicbE0CdOnV82LBhLSdNmlTw7rvv5g8aNKi4VatWJQMGDFgLUFxcvGXp0qV133777fpLly7NLSkpqZYL30psGXDttdcuy8vL865du3Zs3rx5l3nz5lV4zvv+++//qkmTJqV9+vRp279//4N79uy5oUePHil94ebk5DBp0qS5Rx999LpLL720uHPnzp0GDRrUau7cuXvsv//+WwF69+694e67714wZsyYpocddljHl156qdFvfvObJZWVO27cuHl777331hNPP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v292Xh1/Ardx9p83TKxE78twhMbv7XIIfCveZ2Z+B8wmufyWaH5ZzdPgeM6tDcF3wb1WIpyo/EqYBHSMmh9gRTVuC65CYWSHBdcGFAFHKC+cdStB4ZGU4bAnBevl33KQ/IvV9rLOZFbj7hvDzEQTrbn74udLt4e7rCE6tP2dmYwiuqbUmuP5rwL7u/kaKcUoVKbFJov8h+NL6wMxuIDiFZQQND64l+DU+KRz+pJldHs53P8EX5OtpiOEIM7uW4IujF3AWwWku0rjsm4D7zexbgpageQSnkVq4+x+SLGMFwa/wfma2gOC63hbgDoLGCQuAIoIv4/fLK8DdN4SJb6SZrQK+JGg0UQQ8GKE+hMvrGR5NrAfWJDnfSOC/4enChwkaV7QD+rv7ryuIe46ZvQTca2a/Br4BhhOsk/HlzRPHzGzf8P1e/NDcfy/gp3HT3Q6MMLO5wIcE18KOIdhOqcgFRpvZCIIfRLcBj8QSXWXbw8yGERyxTic4KjuD4Ij0a3ffGB6tjzGzqwj2y70J9uMv3P2FFGOXJCixyXbc/QszOxS4juALrwVBs/wZBE3fcXc3swEEF9Fjv0onAZe6ezpOn91F0JrxdwStAW909+fSuWx3f9TMNhBcn/kDQYL6FEj6Bmd3Lw3v5bqRIFH+B+gLNCK4DtOMYN2NB/53J0X9Nvz7GEEz+o+AE9x9aYVzlO8OgtNiswjuKTswyXp8bGbHArcQNPmvQ3BrQ2WnowcTbKuXCX78vA30dveNlcxXnyAxOEESnR+WcY+7r4ib7j5gT+CPBInlc4IWtDOSqddOvEmwrd8IY3keuDpufGXbYx3BfnNwWIePgBPj6n0Owb77R2A/gh8YU/hhf5VqpidoS40SHvn8yd3vyHQskn3C04ZN3P3/ZToWqT5qFSkiIllFiU1ERLKKTkWKiEhW0RGbiIhkFSU2ERHJKkpsIiKSVZTYREQkqyixiYhIVlFiExGRrPL/Afc+Ax2yyhb+AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x216 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mpl.rc('font', size=14)\n",
    "plt.figure(figsize=(6, 3))\n",
    "w = 0.3  # bar width\n",
    "idx = -1  # coarse level\n",
    "\n",
    "args = dict(width=w, zorder=10)\n",
    "plt.bar(np.arange(6)-w/2, dampings['CMU'][idx], color=(1, .5, .5), label='trained on CMU', **args)\n",
    "plt.bar(np.arange(6)+w/2, dampings['MD'][idx], color='#5fa7d9', label='trained on MegaDepth', **args)\n",
    "\n",
    "plt.xlabel('Components of the 6-DoF pose')\n",
    "plt.xticks(range(6), ('$t_x$', '$t_y$', '$t_z$', '$R_x$', '$R_y$', '$R_z$'))\n",
    "\n",
    "plt.yscale('log')\n",
    "plt.ylabel('Damping factor $\\lambda$')\n",
    "plt.ylim([1.1e-7, 200])\n",
    "plt.tight_layout()\n",
    "plt.grid(axis='y')\n",
    "plt.gca().set_zorder(20)\n",
    "plt.legend(ncol=2, bbox_to_anchor=(0.5, 1.2), loc='center');\n",
    "\n",
    "# plt.savefig('learned_damping_factors.pdf', bbox_inches='tight', pad_inches=0)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
